def main():
    for n in hui():
        if n < 1000:
            print(n)
        else:
            break   

def iter():
    n = 1
    while True:
        n = n + 1
        yield n 

def is_palindrome(n):
    a = str(n)
    b = a[::-1]
    return a == b

def hui():
    yield 2
    it = iter()
    while True:
        n = next(it)
        yield n 
        it = filter(is_palindrome,it)

if __name__ == '__main__':
    main()